home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / MacApp / MacApp 3.0a2 / CPlusIncludes / PrintTraps.h < prev    next >
Text File  |  1991-05-01  |  11KB  |  347 lines

  1. /************************************************************
  2.  
  3. Created: Thursday, September 7, 1989 at 5:45 PM
  4.     PrintTraps.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.     Copyright Apple Computer, Inc.    1985-1989
  9.     All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __PRINTTRAPS__
  15. #define __PRINTTRAPS__
  16.  
  17. #ifndef __GEOMETRY__
  18. #include <Geometry.h>
  19. #endif
  20.  
  21. #ifndef __QUICKDRAW__
  22. #include <Quickdraw.h>
  23. #endif
  24.  
  25. #ifndef __DIALOGS__
  26. #include <Dialogs.h>
  27. #endif
  28.  
  29. enum {bDraftLoop = 0};
  30. enum {bSpoolLoop = 1};
  31. enum {iPFMaxPgs = 128};             /*Max number of pages in a print file.*/
  32. enum {iPrPgFract = 120};
  33. enum {iPrPgFst = 1};                /*Page range constants*/
  34. enum {iPrPgMax = 9999};
  35. enum {iPrRelease = 2};              /*Current version number of the code.*/
  36. enum {iPrSavPFil = -1};
  37. enum {iIOAbort = -27};
  38. enum {pPrGlobals = 0x00000944};
  39. enum {bUser1Loop = 2};
  40. enum {bUser2Loop = 3};
  41. enum {fNewRunBit = 2};              /*Bit 2 (3rd bit) in bDocLoop is new JobRun indicator.*/
  42. enum {fHiResOK = 3};                /*Bit 3 (4th bit) in bDocLoop is hi res indicator for paint.*/
  43. enum {fWeOpenedRF = 4};             /*Bit 4 (5th bit) in bDocLoop is set if driver opened the pr res file.*/
  44. enum {iPrAbort = 128};
  45. enum {iPrDevCtl = 7};               /*The PrDevCtl Proc's ctl number*/
  46. enum {lPrReset = 0x00010000};       /*The PrDevCtl Proc's CParam for reset*/
  47. enum {lPrLineFeed = 0x00030000};
  48. enum {lPrLFStd = 0x0003FFFF};       /*The PrDevCtl Proc's CParam for std paper advance*/
  49. enum {lPrLFSixth = 0x0003FFFF};
  50. enum {lPrPageEnd = 0x00020000};     /*The PrDevCtl Proc's CParam for end page*/
  51. enum {lPrDocOpen = 0x00010000};     /*note: same as lPrReset low order byte indicates number of copies to print*/
  52. enum {lPrPageOpen = 0x00040000};
  53. enum {lPrPageClose = 0x00020000};   /*note: same as lPrPageEnd*/
  54. enum {lPrDocClose = 0x00050000};
  55. enum {iFMgrCtl = 8};                /*The FMgr's Tail-hook Proc's ctl number*/
  56. enum {iMscCtl = 9};                 /*Msc Text state / Drvr State ctl number*/
  57. enum {iPvtCtl = 10};                /*Private ctls start here*/
  58. enum {iMemFullErr = -108};
  59.  
  60. /*
  61. Driver constants */
  62.  
  63. enum {iPrBitsCtl = 4};              /*The Bitmap Print Proc's ctl number*/
  64. enum {lScreenBits = 0};             /*The Bitmap Print Proc's Screen Bitmap param*/
  65. enum {lPaintBits = 1};              /*The Bitmap Print Proc's Paint [sq pix] param*/
  66. enum {lHiScreenBits = 0x00000002};  /*The Bitmap Print Proc's Screen Bitmap param*/
  67. enum {lHiPaintBits = 0x00000003};   /*The Bitmap Print Proc's Paint [sq pix] param*/
  68. enum {iPrIOCtl = 5};                /*The Raw Byte IO Proc's ctl number*/
  69. enum {iPrEvtCtl = 6};               /*The PrEvent Proc's ctl number*/
  70. enum {lPrEvtAll = 0x0002FFFD};      /*The PrEvent Proc's CParam for the entire screen*/
  71. enum {lPrEvtTop = 0x0001FFFD};      /*The PrEvent Proc's CParam for the top folder*/
  72. #define sPrDrvr ".Print"
  73. enum {iPrDrvrRef = -3};
  74. enum {getRslDataOp = 4};            /*PrGeneral Cs*/
  75. enum {setRslOp = 5};                /*PrGeneral Cs*/
  76. enum {draftBitsOp = 6};             /*PrGeneral Cs*/
  77. enum {noDraftBitsOp = 7};           /*PrGeneral Cs*/
  78. enum {getRotnOp = 8};               /*PrGeneral Cs*/
  79. enum {NoSuchRsl = 1};               /*PrGeneral Cs*/
  80. enum {RgType1 = 1};                 /*PrGeneral Cs*/
  81.  
  82. enum {feedCut,feedFanfold,feedMechCut,feedOther};
  83. typedef unsigned char TFeed;
  84.  
  85. enum {scanTB,scanBT,scanLR,scanRL};
  86. typedef unsigned char TScan;
  87.  
  88. typedef Rect *TPRect;
  89.  
  90. typedef pascal void (*PrIdleProcPtr)(void);
  91. typedef pascal void (*PItemProcPtr)(DialogPtr theDialog, short item);
  92.  
  93. struct TPrPort {
  94.     GrafPort gPort;                 /*The Printer's graf port.*/
  95.     QDProcs gProcs;                 /*..and its procs*/
  96.     long lGParam1;                    /*16 bytes for private parameter storage.*/
  97.     long lGParam2;
  98.     long lGParam3;
  99.     long lGParam4;
  100.     Boolean fOurPtr;                /*Whether the PrPort allocation was done by us.*/
  101.     Boolean fOurBits;                /*Whether the BitMap allocation was done by us.*/
  102. };
  103.  
  104. typedef struct TPrPort TPrPort;
  105. typedef TPrPort *TPPrPort;
  106.  
  107. /* Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  108. This is the "PrPeek" record. */
  109. struct TPrInfo {
  110.     short iDev;                     /*Font mgr/QuickDraw device code*/
  111.     short iVRes;                    /*Resolution of device, in device coordinates*/
  112.     short iHRes;                    /*..note: V before H => compatable with Point.*/
  113.     Rect rPage;                     /*The page (printable) rectangle in device coordinates.*/
  114. };
  115.  
  116. typedef struct TPrInfo TPrInfo;
  117. typedef TPrInfo *TPPrInfo;
  118.  
  119. /* Print Info Record: The parameters needed for page composition. */
  120. struct TPrStl {
  121.     short wDev;                     /*The device (driver) number. Hi byte=RefNum, Lo byte=variant. f0 = fHiRes f1 = fPortrait, f2 = fSqPix, f3 = f2xZoom, f4 = fScroll.*/
  122.     short iPageV;                    /*paper size in units of 1/iPrPgFract*/
  123.     short iPageH;                    /* ..note: V before H => compatable with Point.*/
  124.     char bPort;                     /*The IO port number. Refnum?*/
  125.     TFeed feed;                     /*paper feeder type.*/
  126. };
  127.  
  128. typedef struct TPrStl TPrStl;
  129. typedef TPrStl *TPPrStl;
  130.  
  131. /* Printer Style: The printer configuration and usage information. */
  132. struct TPrXInfo {
  133.     short iRowBytes;
  134.     short iBandV;
  135.     short iBandH;
  136.     short iDevBytes;
  137.     short iBands;
  138.     char bPatScale;
  139.     char bUlThick;
  140.     char bUlOffset;
  141.     char bUlShadow;
  142.     TScan scan;
  143.     char bXInfoX;
  144. };
  145.  
  146. typedef struct TPrXInfo TPrXInfo;
  147. typedef TPrXInfo *TPPrXInfo;
  148.  
  149. struct TPrJob {
  150.     short iFstPage;
  151.     short iLstPage;
  152.     short iCopies;
  153.     char bJDocLoop;
  154.     Boolean fFromUsr;
  155.     PrIdleProcPtr pIdleProc;
  156.     StringPtr pFileName;
  157.     short iFileVol;
  158.     char bFileVers;
  159.     char bJobX;
  160. };
  161.  
  162. typedef struct TPrJob TPrJob;
  163. typedef TPrJob *TPPrJob;
  164.  
  165. struct TPrint {
  166.     short iPrVersion;                /*(2) Printing software version*/
  167.     TPrInfo prInfo;                 /*(14) the PrInfo data associated with the current style.*/
  168.     Rect rPaper;                    /*(8) The paper rectangle [offset from rPage]*/
  169.     TPrStl prStl;                    /*(8)  This print request's style.*/
  170.     TPrInfo prInfoPT;                /*(14)    Print Time Imaging metrics*/
  171.     TPrXInfo prXInfo;                /*(16)    Print-time (expanded) Print info record.*/
  172.     TPrJob prJob;                    /*(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120*/
  173.     short printX[19];                /*Spare to fill to 120 bytes!*/
  174. };
  175.  
  176. typedef struct TPrint TPrint;
  177. typedef TPrint *TPPrint, **THPrint;
  178.  
  179. /* The universal 120 byte printing record */
  180. struct TPrStatus {
  181.     short iTotPages;                /*Total pages in Print File.*/
  182.     short iCurPage;                 /*Current page number*/
  183.     short iTotCopies;                /*Total copies requested*/
  184.     short iCurCopy;                 /*Current copy number*/
  185.     short iTotBands;                /*Total bands per page.*/
  186.     short iCurBand;                 /*Current band number*/
  187.     Boolean fPgDirty;                /*True if current page has been written to.*/
  188.     Boolean fImaging;                /*Set while in band's DrawPic call.*/
  189.     THPrint hPrint;                 /*Handle to the active Printer record*/
  190.     TPPrPort pPrPort;                /*Ptr to the active PrPort*/
  191.     PicHandle hPic;                 /*Handle to the active Picture*/
  192. };
  193.  
  194. typedef struct TPrStatus TPrStatus;
  195. typedef TPrStatus *TPPrStatus;
  196.  
  197. /* Print Status: Print information during printing. */
  198. struct TPfPgDir {
  199.     short iPages;
  200.     long iPgPos[129];                /*ARRAY [0..iPfMaxPgs] OF LONGINT*/
  201. };
  202.  
  203. typedef struct TPfPgDir TPfPgDir;
  204. typedef TPfPgDir *TPPfPgDir, **THPfPgDir;
  205.  
  206. /* PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) */
  207. struct TPrDlg {
  208.     DialogRecord Dlg;                /*The Dialog window*/
  209.     ModalFilterProcPtr pFltrProc;    /*The Filter Proc.*/
  210.     PItemProcPtr pItemProc;         /*The Item evaluating proc.*/
  211.     THPrint hPrintUsr;                /*The user's print record.*/
  212.     Boolean fDoIt;
  213.     Boolean fDone;
  214.     long lUser1;                    /*Four longs for user's to hang global data.*/
  215.     long lUser2;                    /*...Plus more stuff needed by the particular printing dialog.*/
  216.     long lUser3;
  217.     long lUser4;
  218. };
  219.  
  220. typedef struct TPrDlg TPrDlg;
  221. typedef TPrDlg *TPPrDlg;
  222.  
  223. typedef pascal TPPrDlg (*PDlgInitProcPtr)(THPrint hPrint);
  224.  
  225. /* This is the Printing Dialog Record. Only used by folks appending their own dialogs.
  226. Print Dialog: The Dialog Stream object. */
  227.  
  228.  
  229. struct TGnlData {
  230.     short iOpCode;
  231.     short iError;
  232.     long lReserved;                 /*more fields here depending on call*/
  233. };
  234.  
  235. typedef struct TGnlData TGnlData;
  236. struct TRslRg {
  237.     short iMin;
  238.     short iMax;
  239. };
  240.  
  241. typedef struct TRslRg TRslRg;
  242. struct TRslRec {
  243.     short iXRsl;
  244.     short iYRsl;
  245. };
  246.  
  247. typedef struct TRslRec TRslRec;
  248. struct TGetRslBlk {
  249.     short iOpCode;
  250.     short iError;
  251.     long lReserved;
  252.     short iRgType;
  253.     TRslRg xRslRg;
  254.     TRslRg yRslRg;
  255.     short iRslRecCnt;
  256.     TRslRec rgRslRec[27];
  257. };
  258.  
  259. typedef struct TGetRslBlk TGetRslBlk;
  260. struct TSetRslBlk {
  261.     short iOpCode;
  262.     short iError;
  263.     long lReserved;
  264.     THPrint hPrint;
  265.     short iXRsl;
  266.     short iYRsl;
  267. };
  268.  
  269. typedef struct TSetRslBlk TSetRslBlk;
  270. struct TDftBitsBlk {
  271.     short iOpCode;
  272.     short iError;
  273.     long lReserved;
  274.     THPrint hPrint;
  275. };
  276.  
  277. typedef struct TDftBitsBlk TDftBitsBlk;
  278. struct TGetRotnBlk {
  279.     short iOpCode;
  280.     short iError;
  281.     long lReserved;
  282.     THPrint hPrint;
  283.     Boolean fLandscape;
  284.     char bXtra;
  285. };
  286.  
  287. typedef struct TGetRotnBlk TGetRotnBlk;
  288. #ifdef __cplusplus
  289. extern "C" {
  290. #endif
  291. pascal void PrPurge(void)
  292.     = {0x2F3C,0xA800,0x0000,0xA8FD};
  293. pascal void PrNoPurge(void)
  294.     = {0x2F3C,0xB000,0x0000,0xA8FD};
  295. pascal Handle PrDrvrDCE(void)
  296.     = {0x2F3C,0x9400,0x0000,0xA8FD};
  297. pascal short PrDrvrVers(void)
  298.     = {0x2F3C,0x9A00,0x0000,0xA8FD};
  299. pascal void PrOpen(void)
  300.     = {0x2F3C,0xC800,0x0000,0xA8FD};
  301. pascal void PrClose(void)
  302.     = {0x2F3C,0xD000,0x0000,0xA8FD};
  303. pascal void PrintDefault(THPrint hPrint)
  304.     = {0x2F3C,0x2004,0x0480,0xA8FD};
  305. pascal Boolean PrValidate(THPrint hPrint)
  306.     = {0x2F3C,0x5204,0x0498,0xA8FD};
  307. pascal Boolean PrStlDialog(THPrint hPrint)
  308.     = {0x2F3C,0x2A04,0x0484,0xA8FD};
  309. pascal Boolean PrJobDialog(THPrint hPrint)
  310.     = {0x2F3C,0x3204,0x0488,0xA8FD};
  311. pascal void PrJobMerge(THPrint hPrintSrc,THPrint hPrintDst)
  312.     = {0x2F3C,0x5804,0x089C,0xA8FD};
  313. pascal TPPrPort PrOpenDoc(THPrint hPrint,TPPrPort pPrPort,Ptr pIOBuf)
  314.     = {0x2F3C,0x0400,0x0C00,0xA8FD};
  315. pascal void PrCloseDoc(TPPrPort pPrPort)
  316.     = {0x2F3C,0x0800,0x0484,0xA8FD};
  317. pascal void PrOpenPage(TPPrPort pPrPort,TPRect pPageFrame)
  318.     = {0x2F3C,0x1000,0x0808,0xA8FD};
  319. pascal void PrClosePage(TPPrPort pPrPort)
  320.     = {0x2F3C,0x1800,0x040C,0xA8FD};
  321. pascal void PrPicFile(THPrint hPrint,TPPrPort pPrPort,Ptr pIOBuf,Ptr pDevBuf,
  322.     TPrStatus& prStatus)
  323.     = {0x2F3C,0x6005,0x1480,0xA8FD};
  324. pascal short PrError(void)
  325.     = {0x2F3C,0xBA00,0x0000,0xA8FD};
  326. pascal void PrSetError(short iErr)
  327.     = {0x2F3C,0xC000,0x0200,0xA8FD};
  328. pascal void PrGeneral(Ptr pData)
  329.     = {0x2F3C,0x7007,0x0480,0xA8FD};
  330. pascal void PrDrvrOpen(void)
  331.     = {0x2F3C,0x8000,0x0000,0xA8FD};
  332. pascal Boolean PrDlgMain(THPrint hPrint,PDlgInitProcPtr pDlgInit)
  333.     = {0x2F3C,0x4A04,0x0894,0xA8FD};
  334. pascal void PrDrvrClose(void)
  335.     = {0x2F3C,0x8800,0x0000,0xA8FD};
  336. pascal TPPrDlg PrJobInit(THPrint hPrint)
  337.     = {0x2F3C,0x4404,0x0410,0xA8FD};
  338. pascal void PrCtlCall(short iWhichCtl,long lParam1,long lParam2,long lParam3)
  339.     = {0x2F3C,0xA000,0x0E00,0xA8FD};
  340. pascal TPPrDlg PrStlInit(THPrint hPrint)
  341.     = {0x2F3C,0x3C04,0x040C,0xA8FD};
  342. #ifdef __cplusplus
  343. }
  344. #endif
  345.  
  346. #endif
  347.